package com.bdqn.controller;

import com.bdqn.pojo.Sys_menu;
import com.bdqn.service.Sys_menuService;
import com.bdqn.service.Sys_userService;
import com.bdqn.util.FileUploadUtil;
import com.bdqn.util.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.awt.*;
import java.util.List;

@RestController
@CrossOrigin  //允许跨域访问
@RequestMapping("/menu")
public class Sys_menuController {
    @Autowired
    Sys_menuService sysMenuService;
    @Autowired
    TokenUtil tokenUtil;
    @Autowired
    FileUploadUtil fileUploadUtil;

    @GetMapping("getUserMenus")
    public List<Sys_menu> getUserMenus(@RequestHeader("token") String token){
        int userid=tokenUtil.getUid(token);
        List<Sys_menu> list=sysMenuService.getUserMenus(userid);
        return list;
    }

    @GetMapping("getMenus")
    public List<Sys_menu> getMenus(){
        List<Sys_menu> list=sysMenuService.getMenusAll();
        return list;
    }

}
